﻿<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<!--suppress HtmlRequiredTitleElement -->
<head>
    <th:block th:include="include :: header('参数列表')"/>
</head>
<body class="layui-layout-body theme-himio layui-anim layui-anim-upbit">
<!-- 正文开始 -->
<div class="layui-fluid">
    <div class="layui-card">
        <div class="layui-card-body">
            <!-- 表格工具栏 -->
            <form class="layui-form toolbar">
                <div class="layui-form-item">
                    <div class="layui-inline">
                        <label class="layui-form-label">参数名称:</label>
                        <div class="layui-input-inline">
                            <input name="configName" class="layui-input" placeholder="参数名称"/>
                        </div>
                    </div>
                    <div class="layui-inline">
                        <label class="layui-form-label">参数键名:</label>
                        <div class="layui-input-inline">
                            <input name="configKey" class="layui-input" placeholder="参数键名"/>
                        </div>
                    </div>
                    <div class="layui-inline" th:classappend="${@permission.hasRole('admin')}">
                        <label class="layui-form-label">系统内置:</label>
                        <div class="layui-input-inline">
                            <label>
                                <select name="configType" th:with="type=${@dict.getType('sys_yes_no')}">
                                    <option value="">全部</option>
                                    <option th:each="dict : ${type}" th:text="${dict.dictLabel}"
                                            th:value="${dict.dictValue}">
                                    </option>
                                </select>
                            </label>
                        </div>
                    </div>
                    <div class="layui-inline">&emsp;
                        <button class="layui-btn icon-btn" lay-filter="configTbSearch" lay-submit>
                            <i class="layui-icon layui-icon-search"></i>搜索
                        </button>
                    </div>
                </div>
            </form>
            <!-- 数据表格 -->
            <table id="configTable" lay-filter="configTable"></table>
        </div>
    </div>
</div>

<!--表格操作工具按钮-->
<script type="text/html" id="configTbBar">
    <a class="layui-btn layui-btn-sm icon-btn" lay-event="edit" shiro:hasPermission="system:config:edit"><i
            class="fa fa-edit"></i>修改</a>
    <a class="layui-btn layui-btn-danger layui-btn-sm icon-btn" lay-event="del"
       shiro:hasPermission="system:config:remove"><i class="fa fa-trash"></i>删除</a>
</script>

<!-- 表单弹窗 -->
<script type="text/html" id="configEditDialog">
    <form id="configEditForm" lay-filter="configEditForm" class="layui-form model-form">
        <input name="configId" type="hidden"/>
        <div class="layui-form-item">
            <label class="layui-form-label layui-form-required">参数名称:</label>
            <div class="layui-input-block">
                <input name="configName" class="layui-input" lay-verType="tips" lay-verify="required" required/>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label layui-form-required">参数键名:</label>
            <div class="layui-input-block">
                <input name="configKey" class="layui-input" lay-verType="tips" lay-verify="required" required/>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label layui-form-required">参数键值:</label>
            <div class="layui-input-block">
                <input name="configValue" class="layui-input" lay-verType="tips" lay-verify="required" required/>
            </div>
        </div>
        <div class="layui-form-item" th:classappend="${@permission.hasRole('admin')}">
            <label class="layui-form-label layui-form-required">系统内置:</label>
            <div class="layui-input-block">
                <input type="radio" th:each="dict : ${@dict.getType('sys_yes_no')}" th:id="${dict.dictCode}"
                       name="configType" th:value="${dict.dictValue}" th:title="${dict.dictLabel}"
                       th:checked="${dict.default}"/>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">备注:</label>
            <div class="layui-input-block">
                <label>
                    <textarea name="remark" class="layui-textarea"></textarea>
                </label>
            </div>
        </div>
        <div class="layui-form-item text-right">
            <button class="layui-btn" lay-filter="configEditSubmit" lay-submit>保存</button>
            <button class="layui-btn layui-btn-primary" type="button" ew-event="closeDialog">取消</button>
        </div>
    </form>
</script>

<!-- js部分 -->
<th:block th:include="include :: footer"/>
<script th:inline="javascript">
    var addFlag = [[${@permission.hasPermit('system:config:add')}]];
    var editFlag = [[${@permission.hasPermit('system:config:edit')}]];
    var removeFlag = [[${@permission.hasPermit('system:config:remove')}]];
    var exportFlag = [[${@permission.hasPermit('system:config:export')}]];
    var dictSysYesNo = [[${@dict.getType('sys_yes_no')}]];
    var prefix = ctx + "system/config";
</script>
<script th:src="@{/static/assets/system/js/config.js}"></script>
</body>
</html>
